/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.history;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "history_log_logininfo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HistoryLogLoginInfo.findAll", query = "SELECT h FROM HistoryLogLoginInfo h"),
    @NamedQuery(name = "HistoryLogLoginInfo.findById", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.id = :id"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByUserID", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.userID = :userID"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByLoginType", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.loginType = :loginType"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByLogoutType", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.logoutType = :logoutType"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByLoginDateTime", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.loginDateTime = :loginDateTime"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByLogoutDateTime", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.logoutDateTime = :logoutDateTime"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByMac", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.mac = :mac"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByIp4", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.ip4 = :ip4"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByAddress", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.address = :address"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByClientType", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.clientType = :clientType"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByOSType", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.oSType = :oSType"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByClientVersion", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.clientVersion = :clientVersion"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByCreateTime", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.createTime = :createTime"),
    @NamedQuery(name = "HistoryLogLoginInfo.findByTimeStamp", query = "SELECT h FROM HistoryLogLoginInfo h WHERE h.timeStamp = :timeStamp")})
public class HistoryLogLoginInfo implements Serializable {
	public static byte[] EnCode(HistoryLogLoginInfo msg) throws IOException {
		Codec<HistoryLogLoginInfo> Lcode = ProtobufProxy.create(HistoryLogLoginInfo.class);
		return Lcode.encode(msg);
	}
	public static HistoryLogLoginInfo DeCode(byte[] data) throws IOException {
	Codec<HistoryLogLoginInfo> Lcode = ProtobufProxy.create(HistoryLogLoginInfo.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "UserID")
    @Protobuf
	private String userID;
    @Basic(optional = false)
    @Column(name = "LoginType")
    @Protobuf
	private String loginType;
    @Column(name = "LogoutType")
    @Protobuf
	private String logoutType;
    @Column(name = "LoginDateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date loginDateTime;
	@Protobuf
	private long loginDateTimeL;
    @Column(name = "LogoutDateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date logoutDateTime;
	@Protobuf
	private long logoutDateTimeL;
    @Basic(optional = false)
    @Column(name = "Mac")
    @Protobuf
	private String mac;
    @Basic(optional = false)
    @Column(name = "IP4")
    @Protobuf
	private int ip4;
    /*
    @Lob
    @Column(name = "IP6")
    @Protobuf
	private byte[] ip6;
	*/
    @Basic(optional = false)
    @Column(name = "Address")
    @Protobuf
	private String address;
    @Column(name = "ClientType")
    @Protobuf
	private String clientType;
    @Column(name = "OSType")
    @Protobuf
	private String oSType;
    @Column(name = "ClientVersion")
    @Protobuf
	private String clientVersion;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public HistoryLogLoginInfo() {
    }

    public HistoryLogLoginInfo(Integer id) {
        this.id = id;
    }

    public HistoryLogLoginInfo(Integer id, String userID, String loginType, String mac, int ip4, String address) {
        this.id = id;
        this.userID = userID;
        this.loginType = loginType;
        this.mac = mac;
        this.ip4 = ip4;
        this.address = address;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getLoginType() {
        return loginType;
    }

    public void setLoginType(String loginType) {
        this.loginType = loginType;
    }

    public String getLogoutType() {
        return logoutType;
    }

    public void setLogoutType(String logoutType) {
        this.logoutType = logoutType;
    }

    public Date getLoginDateTime() {
        return loginDateTime;
    }

    public void setLoginDateTime(Date loginDateTime) {
        this.loginDateTime = loginDateTime;
        this.setLoginDateTimeL(CodeTool.DateToLong(loginDateTime));
    }

    public Date getLogoutDateTime() {
        return logoutDateTime;
    }

    public void setLogoutDateTime(Date logoutDateTime) {
        this.logoutDateTime = logoutDateTime;
		this.setLogoutDateTimeL(CodeTool.DateToLong(logoutDateTime));
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public int getIp4() {
        return ip4;
    }

    public void setIp4(int ip4) {
        this.ip4 = ip4;
    }

    /*
    public byte[] getIp6() {
        return ip6;
    }

    public void setIp6(byte[] ip6) {
        this.setIp6(ip6);
    }
	*/

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getClientType() {
        return clientType;
    }

    public void setClientType(String clientType) {
        this.clientType = clientType;
    }

    public String getOSType() {
        return getoSType();
    }

    public void setOSType(String oSType) {
        this.setoSType(oSType);
    }

    public String getClientVersion() {
        return clientVersion;
    }

    public void setClientVersion(String clientVersion) {
        this.clientVersion = clientVersion;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoryLogLoginInfo)) {
            return false;
        }
        HistoryLogLoginInfo other = (HistoryLogLoginInfo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.history.HistoryLogLoginInfo[ id=" + id + " ]";
    }

    public long getLoginDateTimeL() {
        return loginDateTimeL;
    }

    public void setLoginDateTimeL(long loginDateTimeL) {
        this.loginDateTimeL = loginDateTimeL;
		this.loginDateTime = CodeTool.LongToDate(loginDateTimeL);
    }

    public long getLogoutDateTimeL() {
        return logoutDateTimeL;
    }

    public void setLogoutDateTimeL(long logoutDateTimeL) {
        this.logoutDateTimeL = logoutDateTimeL;
		this.logoutDateTime = CodeTool.LongToDate(logoutDateTimeL);
    }

    public String getoSType() {
        return oSType;
    }

    public void setoSType(String oSType) {
        this.oSType = oSType;
    }
    
}
